<%-- 
    Document   : configurationForm.jsp
    Created on : Jan 11, 2012, 11:25:19 PM
    Author     : olivier
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html"  prefix="html" %> 
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/struts-tags" prefix="s" %>

<s:form namespace="/peerassessment" action="update_%{moduleCode}_%{peerAssess.peerAssessId}" id="addPAForm">
<s:actionerror/>
    <table>
        <tr>
            <td valign="top">Percent Variation:</td>
            <td><s:textfield name="peerAssess.percentVariation" size="20" /> </td>
        </tr> 
        <tr>
            <td>Maximum Mark:</td>
            <td><s:textfield name="peerAssess.maxMark" size="20" /> 
                </td>
        </tr> 
        <tr>
            <td>From Range:</td>
            <td><s:textfield name="peerAssess.fromRange" size="20" value="0" /> 
                </td>
        </tr> 
        <tr>
            <td>To Range:</td>
            <td><s:textfield name="peerAssess.toRange" size="20" value="10" /> 
                </td>
        </tr> 
        <tr>
            <td>Period:</td>
            <td><s:textfield name="peerAssess.period" size="20" /> 
                </td>
        </tr> 
        <tr>
            <td colspan="2">
                <s:hidden name="update"/>
                <br/>
                <button id="addPAButton">Submit</button>
            </td>
        </tr>
    </table>
 </s:form>
        
<script type="text/javascript">
    $(function(){
        
        $("#addPAForm").submit(function(e){
            e.preventDefault();
            dataString = $("#addPAForm").serialize();

            $.ajax({
                type: "POST",
                url: "<s:url value="/peerassessment/update_%{moduleCode}_%{peerAssess.peerAssessId}"/>",
                data: dataString,
                success: function(data) {
                    $('#tabs').tabs( "load" ,4);
                } 

            }); 
        });    

        $("#addPAButton").button({icons: {primary:'ui-icon-circle-plus'}});
    });
</script>
